import request from '@/utils/request.ts'
import { type RegisterData } from './registerData';
export const userRegister = (registerData: RegisterData) => {
    const param = new URLSearchParams();
    for (let key in registerData) {
        if (Object.prototype.hasOwnProperty.call(registerData, key)) {
            param.append(key, (registerData as any)[key]); // 使用类型断言
        }
    }
    return request.post('/user/register', param); // 使用 param 对象作为第二个参数
}

// 登录接口

export const userLogin = (registerData:RegisterData)=>{
    const param = new URLSearchParams();
    for (let key in registerData) {
        if (Object.prototype.hasOwnProperty.call(registerData, key)) {
            param.append(key, (registerData as any)[key]); // 使用类型断言
        }
    }
    return request.post('/user/login',param);
}